<?php
$id=intval($_GET['id']);
		$cache=new Cache;
		$url=$_POST['url']."&page=";
		$_GET['page']=$_POST['page'];
		$type=$_GET['type'];
		if($_GET['type']=='category'){
		$sql ="select truyen_id from truyen_theloai_fk where theloai_id=$id  order by time_update desc ";
		$sql2="select truyen_id from truyen_theloai_fk where theloai_id=$id ";
		$pager = new Pagination2($sql,15,4,$url,0,"truyen_2");
		$pager->ajax=1;
		$pager->setDebug(false);
		}else
		if($type=='views'||$type=='view_day'||$type=='view_week'||$type=='view_month')
		{
	
		$sql ="select id from truyen  order by  $type desc ";
		$sql2="select id from truyen";
		$pager = new Pagination2($sql,15,4,$url,0,"truyen_1");
		$pager->ajax=1;
		$pager->setDebug(false);
		}
		$data['truyenmoi']['data'] = $pager->paginate($cache,$sql2);
		$data['truyenmoi']['nav']=$pager->renderFullNav();
		//Render data---?>
		 <div class='text-center'><?php echo $data['truyenmoi']['nav']; ?></div>
         	<?php
			echo truyen_render_list_item($data['truyenmoi']['data']);
			?>
         <div class='text-center'><?php echo $data['truyenmoi']['nav']; ?></div> 
         <?php
		exit();
?>